package com.continuing.web.controller.beef;

import java.util.List;

import com.continuing.beef.service.bill.IBillInfoLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.continuing.common.annotation.Log;
import com.continuing.common.core.controller.BaseController;
import com.continuing.common.core.domain.AjaxResult;
import com.continuing.common.enums.BusinessType;
import com.continuing.beef.domain.BillInfoLog;

import com.continuing.common.utils.poi.ExcelUtil;
import com.continuing.common.core.page.TableDataInfo;

/**
 * 账单信息变更记录Controller
 * 
 * @author batata
 * @date 2021-10-01
 */
@RestController
@RequestMapping("/beef/billLog")
public class BillInfoLogController extends BaseController
{
    @Autowired
    private IBillInfoLogService billInfoLogService;

    /**
     * 查询账单信息变更记录列表
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(BillInfoLog billInfoLog)
    {
        startPage();
        List<BillInfoLog> list = billInfoLogService.selectBillInfoLogList(billInfoLog);
        return getDataTable(list);
    }

    /**
     * 导出账单信息变更记录列表
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:export')")
    @Log(title = "账单信息变更记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BillInfoLog billInfoLog)
    {
        List<BillInfoLog> list = billInfoLogService.selectBillInfoLogList(billInfoLog);
        ExcelUtil<BillInfoLog> util = new ExcelUtil<BillInfoLog>(BillInfoLog.class);
        return util.exportExcel(list, "账单信息变更记录数据");
    }

    /**
     * 获取账单信息变更记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(billInfoLogService.selectBillInfoLogById(id));
    }

    /**
     * 新增账单信息变更记录
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:add')")
    @Log(title = "账单信息变更记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BillInfoLog billInfoLog)
    {
        return toAjax(billInfoLogService.insertBillInfoLog(billInfoLog));
    }

    /**
     * 修改账单信息变更记录
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:edit')")
    @Log(title = "账单信息变更记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BillInfoLog billInfoLog)
    {
        return toAjax(billInfoLogService.updateBillInfoLog(billInfoLog));
    }

    /**
     * 删除账单信息变更记录
     */
    @PreAuthorize("@ss.hasPermi('beef:billLog:remove')")
    @Log(title = "账单信息变更记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(billInfoLogService.deleteBillInfoLogByIds(ids));
    }
}
